﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="HistoryQuery" CodeFile="OrderQuery.aspx.cs" MasterPageFile="~/MasterPage.master"%>

 
<%@ Register Src="../UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>订单历史查询</title>
    <style type="text/css">

.default {border:1px #90B1F2 solid; width:150; }
.wsd_button2
{
	border-style: none;
	border-color: inherit;
	border-width: medium;
	font-family: "宋体";
	font-size: 12px;
	padding-top: 4px;
	color: #5E606C;
	background-image: url('../resources/Images/Table/button2.gif');
	background-repeat: no-repeat;
	width: 80px;
	font-weight: 400;
	cursor: hand;
    height: 20px;
}
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
     <script src="../JavaScript/empchecks.js" type="text/javascript"></script>
    <script type="text/javascript">
    /*  
    将Date/String类型,解析为String类型.  
    传入String类型,则先解析为Date类型  
    不正确的Date,返回 ''  
    如果时间部分为0,则忽略,只返回日期部分.  
    */
    function formatDate(v) {
        if (v instanceof Date) {
            var y = v.getFullYear();
            var m = v.getMonth() + 1;
            var d = v.getDate();
            var h = v.getHours();
            var i = v.getMinutes();
            var s = v.getSeconds();
            var ms = v.getMilliseconds();
            if (ms > 0)
                return y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s
						+ '.' + ms;
            if (h > 0 || i > 0 || s > 0)
                return y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s;
            return y + '-' + m + '-' + d;
        }
        return '';
    }

    $(function () {
        $('#<%=txtStart.ClientID %>').datebox({
            currentText: '今天',
            closeText: '关闭',
            disabled: false,
            required: true,
            missingMessage: '必填',
            formatter: formatDate
        });
    });
    $(function () {
        $('#<%=txtEnd.ClientID %>').datebox({
            currentText: '今天',
            closeText: '关闭',
            disabled: false,
            required: true,
            missingMessage: '必填',
            formatter: formatDate
        });
    });
</script>
    <div>
        <table id="wsd_inputtable">
            <tr>
                <td class="tabletitle" colspan="6">
                    搜索选项
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    客户类别:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList runat="server" ID="ddlClass" Width="150">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    区域层次:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList runat="server" ID="ddlLevel" meta:resourcekey="ddlLevelResource1"
                        Width="150">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    销售渠道:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList runat="server" ID="ddlChannel" Width="150">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    门店名称或代码:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox runat="server" ID="txtCode" class="default" Width="150"></asp:TextBox>
                </td>
                <td class="tablefield">
                    起始日期:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox runat="server" ID="txtStart" class="default"   Width="150"></asp:TextBox>
                </td>
                <td class="tablefield">
                    结束日期:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox runat="server" ID="txtEnd" class="default" Width="150"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    经销商:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox ID="txtChains" runat="server" class="default" Width="150"></asp:TextBox>
                </td>
                <td class="tablefield">
                    &nbsp;订单状态:</td>
                <td nowrap="nowrap">
                    <asp:DropDownList runat="server" ID="ddlStatus" class="default" Width="150">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    &nbsp;</td>
                <td nowrap="nowrap">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="buttonarea" colspan="6">
                    <asp:Button ID="btnQuery" runat="server" class="wsd_button2" Text="查  询" OnClick="btnQuery_Click" />
                    &nbsp;&nbsp;
                    <input type="button" class="wsd_button2" size="47" value="重  置" name="reset" onclick="clearForm('form1')" />
                                     
                    <asp:Button ID="btnExportExcel" runat="server" class="wsd_button2" 
                        Text="导出Excel" onclick="btnExportExcel_Click" />
                     
                </td>
            </tr>
        </table>
        <br />
        <table id="wsd_inputtable">
            <tr>
                <td class="tabletitle">
                    订单列表
                </td>
                <td class="tabletitle">
                     
                </td>
            </tr>
        </table>
        <table id="wsd_listtable" width="100%">
            <tr>
                <td style="width: 100%">
                    <asp:GridView Width="100%" ID="gvChannelType" runat="server" AutoGenerateColumns="false"
                     PageSize="30"
                        EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                        EnableEmptyContentRender="true" OnRowDataBound="Grid_RowDataBound" AllowPaging="True" DataKeyNames="ID">
                        <HeaderStyle CssClass="titlist" />
                        <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                        <Columns>
                            <asp:HyperLinkField DataNavigateUrlFormatString="Order_Maintain.aspx?orderID={0}&customerID={1}"
                                DataNavigateUrlFields="ORDER_ID,CUSTOMER_ID" DataTextField="ORDER_NO"  HeaderText="订单号码" ControlStyle-Font-Underline="false"/>
                            <asp:BoundField HeaderText="门店名称" DataField="CUSTOMER_NAME" />
                            <asp:BoundField HeaderText="销售代表" DataField="USER_NAME" />
                           
                            <asp:TemplateField HeaderText="订单日期">
                                    <ItemTemplate>
                                        <asp:Label ID="lblOrder_date" runat="server" Text='<%# Jumpton.SFA.Server.BusinessRule.BusinessLogic.GetDateTime(Eval("ORDER_date").ToString(),"yyyyMMddHHmmss","yyyy-MM-dd")  %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                             <asp:TemplateField HeaderText="要求发货日期">
                                    <ItemTemplate>
                                        <asp:Label ID="lblARRIVAL_date" runat="server" Text='<%# Jumpton.SFA.Server.BusinessRule.BusinessLogic.GetDateTime(Eval("REQ_DELIVERY_date").ToString(),"yyyyMMddHHmmss","yyyy-MM-dd")  %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            <asp:BoundField HeaderText="仓库" DataField="ShipFrom" Visible="false" />
                            <asp:TemplateField HeaderText="订单状态">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblStatusDescription" Text='<%# Jumpton.SFA.Server.Entity.ORDER_HEADERS.GetStatusDescription(Convert.ToInt32(Eval("STATUS"))) %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="金额">
                                <ItemTemplate>
                                   <%# Eval("TOTAL_AMOUNT")%>
                                </ItemTemplate>
                               
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="导出" Visible="false">
                                <HeaderTemplate>
                                     <input  type="checkbox" id="chkAll" name="chkAll" onclick="Check1(this,'ckbSelected')" />全选
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox runat="server" ID="ckbSelected" Visible='<%# (Convert.ToInt32(Eval("STATUS"))==0) %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <RowStyle CssClass="evenline" />
                        <AlternatingRowStyle CssClass="oddline" />
                        <PagerSettings Visible="false" />
                    </asp:GridView>
                    <br />
                    <uc1:GridPager ID="GridPager1" runat="server" />
                </td>
            </tr>
            <tr>
            <td>
             
            </td>
            </tr>
        </table>
        <br />
        <table id="wsd_inputtable" style="display:none">
            <tr>
                <td width="100%" class="tabletitle">
                    操作选项
                </td>
            </tr>
            <tr>
                <td class="buttonarea">
                    <asp:Button ID="btnExport" runat="server" class="wsd_button2" Text="导　出" Visible="false"  OnClick="btnExport_Click" OnClientClick="return HaveCheck('ckbSelected','没有选择任何项');" />
                </td>
            </tr>
        </table>
    </div>
 </asp:Content>